home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
Softshoe
/
Lisa's Mac Parts
/
Views
/
Canvas Loops
/
CanvasScreenLoop.cp
< prev
next >
Wrap
Text File
|
2000-06-23
|
874b
|
49 lines
// CanvasScreenLoop.cp
#ifndef CanvasScreenLoop_h
#include "CanvasScreenLoop.h"
#endif
#ifndef GrafPortObject_h
#include "GrafPortObject.h"
#endif
void CanvasScreenLoop::AdvanceUntilVisible()
{
for ( ; Unfinished(); screen++ )
{
Rectangle screenBounds( screen->Bounds() );
screenBounds += parent.Port().GlobalToLocal();
if ( !screenBounds.Intersects( parent.OnScreen() ) )
continue;
canvas.RestrictOnScreen( screenBounds );
if ( !canvas.Visible() )
{
canvas = parent;
continue;
}
canvasMaintainer.Use( canvas );
break;
}
canvasMaintainer.UseNone();
}
CanvasScreenLoop::CanvasScreenLoop( const Canvas& theParent )
: parent( theParent ),
canvas( theParent )
{
AdvanceUntilVisible();
}
void CanvasScreenLoop::operator++()
{
Assert( Unfinished() );
screen++;
canvas = parent;
AdvanceUntilVisible();
}